@extends('layout/default')

@section('content')
<div class="container ">
    <div clas="row ">
        <form method="post" action="{{URL::to('fight/join')}}">
            <input type="hidden" name="_token" value="{{csrf_token()}}"/>
            <input type="hidden" name="FAFID" value="{{$data->FID}}"/>

            <div class="col-xs-12">
                标题：{{$data->FTitle}}
            </div>
            <div class="col-xs-12">
                时间：{{$data->FBeginAt}}
            </div>
            <div class="col-xs-12" style="margin-top: 1em">
                留言：{{$data->FMessage}}
            </div>
            <div class="col-xs-12">
                联系人：{{$data->FLinkman}}
            </div>
            <div class="col-xs-12">
                联系电话：{{$data->FMobile}}
            </div>
            <div class="col-xs-12">
                申请信息：
                <div>
                    @foreach($applys as $v)
                    <div>
                        <table style="width: 100%;border-bottom: 1px solid #000000">
                            <tr>
                                <th>姓名:</th>
                                <td>{{$v->CName}}</td>
                            </tr>
                            <tr>
                                <th>电话:</th>
                                <td>{{$v->CMobile}}</td>
                            </tr>
                            <tr>
                                <th>留言:</th>
                                <td>{{$v->FAMessage}}</td>
                            </tr>
                            <tr>
                                <th>状态:</th>
                                <td>
                                    <select class="status" data-value="{{$v->FAID}}" data-toggle="tooltip" data-placement="right" title="Tooltip on right">
                                        <option value="0" @if($v->FARes==0) selected="" @endif>未查看</option>
                                        <option value="1" @if($v->FARes==1) selected="" @endif>不同意</option>
                                        <option value="2" @if($v->FARes==2) selected="" @endif>同意</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                    @endforeach
                </div>
            </div>
        </form>
    </div>
</div>
<div class="modal fade" id="alert">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">温馨提示</h4>
            </div>
            <div class="modal-body">
                <p>您已经成功修改状态</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@endsection
@section('scripts')
<script>
    $(function () {
        $(".status").change(function () {
            var FAID = $(this).attr("data-value");
            var FARes = $(this).val();
            //alert(FARes)
            $.ajax({
                type: "POST",
                async: false,
                url: "{{URL::to('fight/changeStatus')}}",
                data: {FAID: FAID, FARes: FARes, _token: "{{csrf_token()}}"},
                dataType: "html",
                cache: false,
                success: function (data) {
                    if (data == 1) {
                        $("#alert").modal('show');
                    } else {
                        alert('3334');

                    }
                }
            });
        });
    });
</script>
@endsection
